<?php

    function full_path(&$data) {

        /*
          Details
          ______________________________________________________________________ */

        if (isset($data->photo_path)):

            $data->full_path = GALLERY_URL . $data->photo_path . '/';
            $data->image_name = $data->photo_name;
            $data->image_title = $data->photo_title;

        endif;

        if (isset($data->photos))
            foreach ($data->photos as &$photo):

                $photo->full_path = GALLERY_URL . $photo->path . '/';
                $photo->image_name = $photo->photo_name;
                $photo->image_title = $photo->photo_title;

            endforeach;

        if (isset($data->rooms))
            foreach ($data->rooms as &$room):

                if (isset($room->photos))
                    foreach ($room->photos as &$photo):

                        $photo->full_path = GALLERY_URL . $data->photo_path . '/rooms/' . $photo->path . '/';
                        $photo->image_name = $photo->photo_name;
                        $photo->image_title = $photo->photo_title;

                    endforeach;

            endforeach;

        /*
          Checkout
          ______________________________________________________________________ */

        if (isset($data->room->photos))
            foreach ($data->room->photos as &$photo):

                $photo->full_path = GALLERY_URL . $data->photo_path . '/rooms/' . $photo->path . '/';
                $photo->image_name = $photo->photo_name;
                $photo->image_title = $photo->photo_title;

            endforeach;
    }

    function excursions_full_path(&$data) {

        /* -----------------------------------------------------------------------
          searchExcursions
          ----------------------------------------------------------------------- */

        if (isset($data->photo_path)):

            $data->full_path = GALLERY_URL . $data->photo_path . '/';
            $data->image_name = $data->photo_name;
            $data->image_title = $data->photo_title;

        endif;

        if (isset($data->photos))
            foreach ($data->photos as &$photo):

                $photo->full_path = GALLERY_URL . $data->photo_path . '/';
                $photo->image_name = $photo->filename;
                $photo->image_title = $photo->title;

            endforeach;
    }
    
    function transfers_full_path(&$data) {

        /* -----------------------------------------------------------------------
          searchTransfers
          ----------------------------------------------------------------------- */

        if (isset($data->filename)):

            $data->full_path = GALLERY_URL . $data->path . '/';
            $data->image_name = $data->filename;
            $data->image_title = $data->title;

        endif;

//        if (isset($data->photos))
//            foreach ($data->photos as &$photo):
//
//                $photo->full_path = GALLERY_URL . $data->photo_path . '/';
//                $photo->image_name = $photo->filename;
//                $photo->image_title = $photo->title;
//
//            endforeach;
    }
    